import items1 from './items1.js';
import items2 from './items2.js';
import { $TableTabs } from '@/.jiess';
import Add from './components/AddEdit/Add.js';
import { studentApi, teacherApi } from '@/services/api-common';
const setup = {
	name: 'DemoTable',
	isJiess: true,
	setup() {
		this.add(
			this.render({
				is: $TableTabs,
				tables: [{
					is: 'SuperTable',
					items: items1,
					tabTitle: '学生信息',
					httpApi: studentApi.list,
					httpKey: studentApi.listKey,
					container(midder) {
						return {
							title: '学生列表',
							extra: this.render({
								midder,
								is: 'TableTools',
								buttons: [{
									type: 'primary',
									text: '新增',
									onClick: () => {
										midder.open(Add, studentApi.add, 'add', {
											// param: { wrapClassName: 'no-padding' }
										})
									}
								}]
							}).getNative()
						}
					},
					filter(midder) {
						return this.render({
							is: 'TableFilter',
							title: '筛选区1',
							midder
						})
					},
				}, {
					is: 'SuperTable',
					items: items2,
					tabTitle: '老师信息',
					httpApi: teacherApi.list,
					httpKey: teacherApi.listKey,
					container(midder) {
						return {
							title: '老师列表',
							extra: this.render({
								midder,
								is: 'TableTools',
								buttons: [{
									type: 'primary',
									text: '新增',
									onClick: () => {
										midder.open(Add, teacherApi.add, 'add', {
											// param: { wrapClassName: 'no-padding' }
										})
									}
								}]
							}).getNative()
						}
					},
					filter(midder) {
						return this.render({
							is: 'TableFilter',
							title: '筛选区2',
							midder
						})
					},
				}, ]
			})
		)

	}
};
export default setup;